using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace _2DGame
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public abstract class DrawObject
    {
        bool inWorld = false;

        String filename;
        Texture2D texture;

        SpriteBlendMode blendMode;

        public bool InWorld
        {
            get { return inWorld; }
            set { inWorld = value; }
        }

        public Texture2D Texture
        {
            get { return texture; }
        }

        public SpriteBlendMode BlendMode
        {
            get { return blendMode; }
            set { blendMode = value; }
        }

        public DrawObject(String fromFilename, SpriteBlendMode fromBlendMode)
        {
            filename = fromFilename;
            // Make a new entry for this texture in the texture bank if it doesn't exist
            if (Resources.TextureBank.TryGetValue(filename, out texture) == false)
            {
                // Textures will be loaded into the bank during World.LoadContent
                // And we'll make our textureData then
                Resources.TextureBank.Add(filename, null);
            }

            blendMode = fromBlendMode;
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public virtual void LoadContent()
        {
            texture = Resources.TextureBank[filename];
        }

        public abstract void Draw();
    }
}